package cn.jdx.controller;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class IndexController {

    @GetMapping("/index")
    public String index(){
        return "index";
    }

    @GetMapping("/user")
    @RequiresRoles("user") //要求是user角色才能进行访问
    @ResponseBody
    public String role(){
        return "user";
    }


    @GetMapping("/user_add")
    @RequiresPermissions("user:add") //必须拥有user:add权限才能访问
    @ResponseBody
    public String perm(){
        return "user_add";
    }

}
